'use strict';
// Copyright 2014 Blueant Inc. All Rights Reserved.

/**
 * @fileoverview 竞技场
 * @author agl
 */

var arenaGetArenaRivalList = require('./arena/getArenaRivalList.js');
var arenaEnterBattle = require('./arena/enterBattle.js');
var arenaExitBattle = require('./arena/exitBattle.js');
var arenaClearBattleTime = require('./arena/clearBattleTime.js');
var arenaBuyFightTime = require('./arena/buyFightTimes.js');
var arenaSetSoldierList = require('./arena/setSoldierList.js');
var arenaArenaShopBuy = require('./arena/arenaShopBuy.js');
var arenaArenaShopList = require('./arena/arenaShopList.js');
var arenaGetBattleRecord = require('./arena/getBattleRecord.js');

module.exports = function (app) {
    return new Handler(app);
};

var Handler = function (app) {
    this.app = app;
};

/**
 * 获取对手列表
 */
Handler.prototype.getArenaRivalList = function (msg, session, next) {
    arenaGetArenaRivalList(msg, session, next);
};

/**
 * 发起挑战
 */
Handler.prototype.enterBattle = function (msg, session, next) {
    arenaEnterBattle(msg, session, next);
};

/**
 * 结束战斗
 */
Handler.prototype.exitBattle = function (msg, session, next) {
    arenaExitBattle(msg, session, next);
};

/**
 * 清除挑战CD
 */
Handler.prototype.clearBattleTime = function (msg, session, next) {
    arenaClearBattleTime(msg, session, next);
};

/**
 * 购买挑战次数
 */
Handler.prototype.buyFightTime = function (msg, session, next) {
    arenaBuyFightTime(msg, session, next);
};

/**
 * 设置进攻阵容
 */
Handler.prototype.setAttSoldierList = function (msg, session, next) {
    msg.opt_type = 1;
    arenaSetSoldierList(msg, session, next);
};

/**
 * 设置防守阵容
 */
Handler.prototype.setDefSoldierList = function (msg, session, next) {
    msg.opt_type = 2;
    arenaSetSoldierList(msg, session, next);
};

/**
 * 查询竞技场商城
 */
Handler.prototype.arenaShopList = function (msg, session, next) {
    arenaArenaShopList(msg, session, next);
};

/**
 * 竞技场商城购买
 */
Handler.prototype.arenaShopBuy = function (msg, session, next) {
    arenaArenaShopBuy(msg, session, next);
};

/**
 * 查询对战记录
 */
Handler.prototype.getBattleRecord = function (msg, session, next) {
    arenaGetBattleRecord(msg, session, next);
};
